"""
健康检查相关路由
"""
from fastapi import APIRouter
from app.schemas.response import ApiResponse
from datetime import datetime
import platform

router = APIRouter()

@router.get("/status", response_model=ApiResponse)
async def health_status():
    """获取服务健康状态"""
    return ApiResponse(
        success=True,
        data={
            "status": "healthy",
            "timestamp": datetime.utcnow().isoformat(),
            "service": "monitor-backend"
        },
        message="服务运行正常"
    )

@router.get("/system", response_model=ApiResponse)
async def system_info():
    """获取系统信息"""
    # 获取系统信息
    system_info = {
        "platform": platform.system(),
        "platform_version": platform.version(),
        "platform_release": platform.release(),
        "architecture": platform.machine(),
        "processor": platform.processor(),
        "python_version": platform.python_version()
    }
    
    return ApiResponse(
        success=True,
        data=system_info,
        message="系统信息获取成功"
    )

@router.get("/full", response_model=ApiResponse)
async def full_health_check():
    """完整的健康检查"""
    # 基本健康状态
    health_data = {
        "status": "healthy",
        "timestamp": datetime.utcnow().isoformat(),
        "service": "monitor-backend",
        "system": {
            "platform": platform.system(),
            "platform_version": platform.version(),
            "architecture": platform.machine(),
            "python_version": platform.python_version()
        }
    }
    
    return ApiResponse(
        success=True,
        data=health_data,
        message="完整健康检查完成"
    )